/////////////////////////////////////////////////////////////////////////////
// Original code from libhdfs3. Copyright (c) 2013 - 2014, Pivotal Inc.
// All rights reserved. Author: Zhanwei Wang
/////////////////////////////////////////////////////////////////////////////
//  Modifications by Kumo Inc.
// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//



#pragma once

#include <string>
#include <vector>

namespace Hdfs {

class BlockLocation {
public:
    bool isCorrupt() const {
        return corrupt;
    }

    void setCorrupt(bool corrupt) {
        this->corrupt = corrupt;
    }

    const std::vector<std::string> & getHosts() const {
        return hosts;
    }

    void setHosts(const std::vector<std::string> & hosts) {
        this->hosts = hosts;
    }

    int64_t getLength() const {
        return length;
    }

    void setLength(int64_t length) {
        this->length = length;
    }

    const std::vector<std::string> & getNames() const {
        return names;
    }

    void setNames(const std::vector<std::string> & names) {
        this->names = names;
    }

    int64_t getOffset() const {
        return offset;
    }

    void setOffset(int64_t offset) {
        this->offset = offset;
    }

    const std::vector<std::string> & getTopologyPaths() const {
        return topologyPaths;
    }

    void setTopologyPaths(const std::vector<std::string> & topologyPaths) {
        this->topologyPaths = topologyPaths;
    }

private:
    bool corrupt;
    int64_t length;
    int64_t offset;  // Offset of the block in the file
    std::vector<std::string> hosts; // Datanode hostnames
    std::vector<std::string> names; // Datanode IP:xferPort for accessing the block
    std::vector<std::string> topologyPaths; // Full path name in network topology
};

}
